package net.lab1024.sa.admin.module.sast.project.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
import net.lab1024.sa.admin.module.sast.project.domain.ProjectEntity;
import net.lab1024.sa.admin.module.sast.project.domain.ProjectForm;
import net.lab1024.sa.admin.module.sast.project.domain.ProjectQueryForm;
import net.lab1024.sa.admin.module.sast.project.domain.ProjectVO;
import net.lab1024.sa.admin.module.sast.project.service.ProjectService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import org.springframework.web.bind.annotation.*;

/**
 * 项目管理
 */
@RestController
@RequestMapping("/project")
@Tag(name = "项目管理")
public class ProjectController {

    @Resource
    private ProjectService projectService;
    @Operation(summary = "分页查询项目信息")
    @PostMapping("/query")
//    @SaCheckPermission("project:query")
    public ResponseDTO<PageResult<ProjectVO>> queryProjects(@RequestBody ProjectQueryForm projectQueryForm) {
        return projectService.queryProjects(projectQueryForm);
    }
    @Operation(summary = "获取项目总数")
    @GetMapping("/totalCount")
    public ResponseDTO<?> getProjectCount() {
        return projectService.getProjectCount();
    }
    @Operation(summary = "项目创建")
    @PostMapping("/create")
    public ResponseDTO<?> createProject(@RequestBody ProjectForm projectForm) {
        projectService.createProject(projectForm);
        return ResponseDTO.ok();
    }
}
